#include "apue.h"
#include <fcntl.h>

static void lockabyte(const char *name, int fd, off_t offset) {
	if (write_lock(fd, offset, SEEK_SET, 1) < 0)
		err_sys("%s: writew_lock error", name);
	printf("%s: got the lock, byte %lld\n", name, (long long)offset);
}

int main(void) {
	int fd;
	pid_t pid;
	if ((fd = creat("templock", FILE_MODE)) < 0)
		err_sys("creat error");
	if ((write(fd, "ab", 2)) != 2)
		err_sys("write error");
	


	
